import Vue from 'vue'
import Vuex from 'vuex'
// import vueXAlong from 'vuex-along'
Vue.use(Vuex)
//创建模块对象
const user={
  state: { 
    userId: '',
    userName: '',
    userClass:'',
    IsLogin:false,
    user: " ", 
    name:" ",
    showLogin: false ,
    count: 0,
   
    listByUser: ''
  },
  getters: {
    getnewId(state){return state.newId},//加了这个
    getUser (state) {
      return state.user
    },
    getUser (state) {
      return state.user
    },
    getName(state)
    {
      return state.name
    },
    getShowLogin (state) {
      return state.showLogin
    },
    getuserId (state) {
      return state.userId
    },
    getuserName (state) {
      return state.userName
    },
    getuserClass (state) {
      return state.userClass
    },
    getIsLogin(state)
    {
      return state.IsLogin
    }
  },
  mutations: {
    setUser (state, data) {
      state.user = data;
    },
    setName (state, data) {
      state.name = data;
    },
    setShowLogin (state, data) {
      state.showLogin = data;
    },
    increment (state) {

      state.count++
    },
    setuserId (state, data) {
      state.userId = data
    },
    setuserName (state, data) {
      state.userName = data
    },
    setuserClass(state,data) {
      state.userClass=data;
    },
    setIsLogin(state,data)
    {
      state.IsLogin=data
    }
  },
  actions: {
    setUser ({ commit }, data) {
      commit('setUser', data);
    },
    setName ({ commit }, data) {
      commit('setName', data);
    },
    setuserId ({ commit }, data) {
      commit('setuserId', data);
    },
    setuserName ({ commit }, data) {
      commit('setuserName', data);
    },
    setuserClass ({ commit }, data) {
      commit('setuserClass', data);
    },
    setIsLogin ({ commit }, data) {
      commit('setIsLogin', data);
    },
    setShowLogin ({ commit }, data) {
      commit('setShowLogin', data);
    },
    addOne (context) {
      context.commit('increment')
    }
  }

}

export default new Vuex.Store({
  namespaced: true,
  state:{
    counter:'hhhh'
},
mutations:{},
actions:{},
// plugins: [vueXAlong],
getters:{},
  modules: {
    user,
   
  },
  
})
